package LanQiao._13JavaB;

import org.junit.Test;

import java.util.*;

public class _3字符统计 {

    @Test
    public void test() {
        System.out.println('B' - 'A');
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        String str = scan.nextLine();
        char[] charArray = str.toCharArray();
        int n = charArray.length;
        HashMap<Character, Integer> map = new HashMap<>();
        StringBuilder sb = new StringBuilder();
        boolean flag = false;
        int max = 0;
        for (int i = 0; i < n; i++) {
            map.put(charArray[i],map.getOrDefault(charArray[i],0) + 1);
            Integer k = map.get(charArray[i]);
            max = Math.max(max,k);
            if (k > n/2){
                sb.append(charArray[i]);
                flag = true;
                break;
            }
        }

        if (flag){
            System.out.println(sb);
        }else {
            Set<Map.Entry<Character, Integer>> entries = map.entrySet();
            for (Map.Entry<Character, Integer> entry : entries) {
                Character key = entry.getKey();
                Integer value = entry.getValue();
                if (value == max) sb.append(key);
            }
            String string = sb.toString();
            char[] stringCharArray = string.toCharArray();
            Arrays.sort(stringCharArray);
            sb.delete(0,sb.length());
            for (int i = 0; i < string.length(); i++) {
                sb.append(stringCharArray[i]);
            }
            System.out.println(sb);
        }
        scan.close();

    }

    //字母hash表 记录次数
    //int[] hashMap = int[26]
    // A = 'A' - 'A' = 0
    // B = 'B' - 'A' = 1
    public class Solution {
        public static void main(String[] args) {
            Scanner scan = new Scanner(System.in);
            //在此输入您的代码...
            String str;
            str = scan.next();
            //String str="BABBACAC";
            int[] m = new int[26];
            for (int i = 0; i < str.length(); i++) {
                m[(int) str.charAt(i) - 65]++;
            }
            int max = 0;
            for (int i = 0; i < 26; i++) {
                if (m[i] > max) {
                    max = m[i];
                }
            }
            for (int i = 0; i < 26; i++) {
                if (m[i] == max) {
                    System.out.print((char) (i + 65));
                }
            }
            scan.close();
        }
    }

}
